package com.marvels.product.param.api.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.marvels.common.constants.MarvelsConstant;
import com.marvels.common.constants.PageConstant;
import com.marvels.common.utils.CacheUtils;
import com.marvels.product.param.api.ProductTypeApi;
import com.marvels.product.param.dao.McptProductTypeDao;
import com.marvels.product.param.dto.McptProductType;

@Service
public class ProductTypeImpl implements ProductTypeApi{

	@Autowired
	private McptProductTypeDao mcptProductTypeMapper;
	@Override
	public List<McptProductType> mcptProductTypeInfo(McptProductType productType) {
		List<McptProductType> list=null;
		list=mcptProductTypeMapper.selectAllInfo(productType);
		return list;
	}
	
	@Override
	public Page<McptProductType> productTypePageInfo(McptProductType productType) {
		int pageNum=productType.getPageNum()==0?PageConstant.CURRPAGE:productType.getPageNum();
		int pageSize=productType.getPageSize()==0?PageConstant.PAGESIZE:productType.getPageSize();
		PageHelper.startPage(pageNum, pageSize);
		Page<McptProductType> list=mcptProductTypeMapper.selectAllInfo(productType);
		return list;
	}
}
